package aop.test01;

import aop.entity.Mingxingimpl;
import aop.hander.MingxingDaili;
import aop.inter.MingXing;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class test001 {
    public static void main(String[] args) {
        MingXing mingXing=new Mingxingimpl();
        InvocationHandler invo=new MingxingDaili(mingXing);
        MingXing proxy= (MingXing) Proxy.newProxyInstance(
                        mingXing.getClass().getClassLoader(),//被代理类的类加载器
                        mingXing.getClass().getInterfaces(),//被代理类实现的接口
                        invo);//被代理类的invocation包装类
        proxy.dosome();
        proxy.doother();
    }
}
